const env = process.env.NODE_ENV

let findUrl

switch (env) {
    case 'development' : {
        let urlObj = {
            '/': 'https://yueju.sjgjj.cn',
            '/jjj': 'https://tip616.com',

        }

        findUrl = url => {
            let completeUrl
            for (let key in urlObj) {
                if (url.indexOf(key) > -1) {
                    let realUrl = url[0] !== '/' ? '/' + url : url
                    completeUrl = urlObj[key] + realUrl
                }
            }
            return completeUrl
        }
        break
    }

    case 'production' : {
        let urlObj = {
            '/': 'https://tip616.com'
        }

        findUrl = url => {
            let completeUrl
            for (let key in urlObj) {
                if (url.indexOf(key) > -1) {
                    let realUrl = url[0] !== '/' ? '/' + url : url
                    completeUrl = urlObj[key] + realUrl
                }
            }
            return completeUrl
        }
        break
    }
}
const baseUrl = findUrl
export {
    baseUrl
}
